import operate from '@dfeidao/atom-nodejs/db/operate';
import doc_code from '@dfeidao/atom-nodejs/msg/doc-code';
import { systemid } from '../../atom/config';
// 这里是添加(一个表)
interface Message {
	filter: {
		productid: string,
				cabinet_staff_no: string,
		staff_name: string,
		staff_nation: string,
		department: string,
		sex: string,
		staff_state: string,
		contact_number: string,
		education: string,
		marital_status: string,
		native_place: string,
		politics_face: string,
		family_address: string,
		department_no: string,
		post_name: string,
		post_no: string,
		project_no: string,
		project_name: string,
		is_resident: string
	};

}
export default async function atom(message: Message, action_id: string, session_id: string) {
	const staff_no=await doc_code(action_id,session_id,systemid,'BM0016459','',1);// 编码规则生成
	const { exec, insert } = operate(action_id, session_id, systemid);
		// 插入数据
		insert('department_staff', {
		cabinet_staff_no:message.filter.cabinet_staff_no,
		staff_name:message.filter.staff_name,
		staff_nation:message.filter.staff_nation,
		sex:message.filter.sex,
		staff_state:message.filter.staff_state,
		contact_number:message.filter.contact_number,
		education:message.filter.education,
		marital_status:message.filter.marital_status,
		native_place:message.filter.native_place,
		politics_face:message.filter.politics_face,
		family_address:message.filter.family_address,
		department_no:message.filter.department_no,
		deptname:message.filter.department,
		post_name:message.filter.post_name,
		post_no:message.filter.post_no,
		staff_no:staff_no.result,
		productid:message.filter.productid
	});
	const res = await exec();
		return res;
}
